]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Telepathy: hide chat notifications when focusing the app
authorGiovanni Campagna <gcampagna@gnome.org>
Tue, 17 Mar 2015 20:08:05 +0000 (13:08 -0700)
committerGiovanni Campagna <gcampagna@gnome.org>
Fri, 27 Mar 2015 20:10:52 +0000 (13:10 -0700)
When the chat app is focused, we should hide all banners immediately.
A good way to do so, without tracking which app is focused, is
to look for messages that are acked when the banner is unexpanded,
which implies they were acked by some other telepathy client.

https://bugzilla.gnome.org/show_bug.cgi?id=746364

js/ui/components/telepathyClient.js

index ba2f3b486b270f8de289e0e3130d8d7f70afb863..38b5347826923fec50cee8d849d7103606879e7b 100644 (file)
@@ -577,6 +577,10 @@ const ChatSource = new Lang.Class({
             this._pendingMessages.splice(idx, 1);
             this.countUpdated();
         }
+
+        if (this._pendingMessages.length == 0 &&
+            this._banner && !this._banner.expanded)
+            this._banner.hide();
     },
 
     _ackMessages: function() {
@@ -830,6 +834,10 @@ const ChatNotificationBanner = new Lang.Class({
             adjustment.value = adjustment.upper;
     },
 
+    hide: function() {
+        this.emit('done-displaying');
+    },
+
     _addMessage: function(message) {
         let highlighter = new Calendar.URLHighlighter(message.body, true, true);
         let body = highlighter.actor;